package com.justech.eat.entity;

import com.justech.eat.util.validator.Radio;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.util.Date;

@Table(name = "e_order_parameter")
@Entity
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class OrderParameter {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private long id;

    @NotNull(message="日期类型不能为空")
    @Radio(values={"0","1"},message = "输入0或1")
    private int dateType;

    @NotNull(message="可选日期不能为空")
    private int optionalDays;

    @NotBlank(message="用户报餐截止日期不能为空")
    @Pattern(regexp = "^([0][0-9]|[1][0-9]|[2][0-4])(:)([0-5][0-9])$",message="输入时间不合法")
    private String userDeadline;

    @NotBlank(message="食堂报餐截止日期不能为空")
    @Pattern(regexp = "^([0][0-9]|[1][0-9]|[2][0-4])(:)([0-5][0-9])$",message="输入时间不合法")
    private String canteenDeadline;

    private Date creatTime;

    private Date updateTime;


}
